package com.juyu.miliao.api.controller;

import com.juyu.miliao.api.domain.QuestionAndAnswerPayCondition;
import com.juyu.miliao.api.service.QuestionAndAnswerPayService;
import com.juyu.miliao.common.domain.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author xuanqicheng
 * @create 2018-19-2:02 PM
 */
@RestController
public class QuestionAndAnswerPayController {

    @Autowired
    private QuestionAndAnswerPayService questionAndAnswerPayService;

    @PostMapping("/answer/pay/create")
    public void createQuestionInfo(Authentication token,QuestionAndAnswerPayCondition condition){

        //获取支付人id
        Subject subject = (Subject) token.getPrincipal();

        questionAndAnswerPayService.createInfo(condition,subject.getId());

    }
}
